﻿using System.Collections.Generic;
using System.Threading.Tasks;
using BCCommon;
using BCCommon.TMS.FreightEnums;
using BCCommon.TMS.Order;
using BCCommon.TMS.Transport;
using BCDto.MySql.FreightConfigurationExtention;
using BCDto.Sim.Admin.Admin;

namespace BCService.TMS.FreightConfigurationExtention
{
    public interface IFreightConfigurationExtentionService
    {
        /// <summary>
        /// 新增零担运费配置
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        FreightConfigurationExtentionDto InsertAsync(FreightConfigurationExtentionRequestDto dto);

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="isSystemAccount">是否超级管理员</param>
        /// <param name="freightConfigurationExtentionId">运费配置id</param>
        /// <param name="dto"></param>
        /// <returns></returns>
        FreightConfigurationExtentionDto UpdateAsync(bool isSystemAccount, int freightConfigurationExtentionId, FreightConfigurationExtentionPutDto dto);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="freightConfigurationExtentionId">运费配置id</param>
        /// <returns></returns>
        void DeleteAsync(int freightConfigurationExtentionId);

        /// <summary>
        /// 通过运费配置id查询
        /// </summary>
        /// <param name="freightConfigurationExtentionId">运费配置id</param>
        /// <returns></returns>
        FreightConfigurationExtentionDto GetById(int freightConfigurationExtentionId);

        /// <summary>
        /// 分页条件查询
        /// </summary>
        /// <param name="admin">管理员信息</param>
        /// <param name="dto"></param>
        /// <returns></returns>
        PageableList<FreightConfigurationExtentionDto> GetAll(AdminDto admin, FreightConfigExtentionListRequestDto dto);
        
        /// <summary>
        /// 初始化修复缺失的区县运费配置
        /// </summary>
        /// <returns></returns>
        bool InitRepair();

        /// <summary>
        /// 获取运费配置
        /// </summary>
        /// <param name="vehicleTypeId">车辆类型Id</param>
        /// <param name="provinceCode">省份Code</param>
        /// <param name="cityCode">市Code</param>
        /// <param name="countyCode">发货地县区Code</param>
        /// <param name="sourceType">订单来源</param>
        /// <param name="freightType">物流类型</param>
        /// <returns></returns>
        FreightConfigurationExtentionDto Get(int? vehicleTypeId, string provinceCode, string cityCode, string countyCode, OrderSourceType? sourceType, FreightType? freightType);
        /// <summary>
        /// 获取运费阶梯
        /// </summary>
        /// <param name="countyCode">区县编码</param>
        /// <param name="maxWeight">最大重量</param>
        /// <param name="orderSourceType">订单来源类型</param>
        /// <param name="freightType">运费类型</param>
        /// <returns></returns>
        FreightConfigurationExtentionDto Get(string countyCode, decimal maxWeight, OrderSourceType orderSourceType, FreightType? freightType);
    }
}